import http from "./request";
// 板块列表
function getBanKuai(){
	return http.get('/api/v1/forums')
}
// 帖子列表
function getTiezi(forum,name,page,per){
	return http.get('/api/v1/posts',{forum,name,page,per})
}
// 帖子详情
function getTieziDetail(id){
	return http.get('/api/v1/posts/'+id)
}
// 发布帖子
function addTiezi(obj){
	console.log('-=-=-=',obj.coverImage);
	return http.post('/api/v1/posts',{forum:obj.forum,name:obj.name,desc:obj.desc,content:obj.content,cover_image:obj.coverImg})
}
// 评论列表
function pinglun(id){
	return http.get('/api/v1/posts/'+id)
}
// 发布评论
function addpinglun(id,content){
	return http.post('/api/v1/comments/'+id,{content})
}
// 获取热门帖子
function remen(){
	return http.get('/api/v1/posts/hot',{nums:20})
}
// 获取热门帖子
function newTie(){
	return http.get('/api/v1/posts/fresh',{nums:20})
}
export {getBanKuai,getTiezi,getTieziDetail,addTiezi,pinglun,addpinglun,remen,newTie}